package simpleGeom;

public class IntGrid2D {
public int[] values;
public int nX;
public int nY;
int n;
public IntGrid2D(int nX,int nY){
	values=new int[nX*nY];
	this.nX=nX;
	this.nY=nY;
	this.n=nX*nY;
}
public int get(int x,int y){
	return values[getIndex(x,y)];
}
public void set(int x,int y,int value){
	 values[getIndex(x,y)]=value;
}
public int getIndex(int x,int y){
	return x*nY+y;
}
public int getX(int index){
	return index/nY;
}
public int getY(int index){
	return index%nY;
}
public void fillAll(int value){
	for (int i=0;i<n;i++){
		values[i]=value;
	}
}
}
